package game.farming.model;

import game.farming.ui.Player;

public abstract class OperatingExpense{
	private String message;
	
	public OperatingExpense(String message){
		this.message = message;
	}
	
	public abstract void performAction(Player p);
	
	public String getMessage(){
		return message;
	}
	
	public void setMessage(String message){
		this.message = message;
	}
	
	public static OperatingExpense OE_SEED_BILL = new OperatingExpense("Seed bill due.\nPay $3,000"){
		public void performAction(Player p){
			p.addCash(-3000);
		}
	};
	public static OperatingExpense OE_CUSTOM_HIRE_1 = new OperatingExpense("Custom hire bill due.\nPay $2,000 if you do not own a tractor."){
		public void performAction(Player p){
			if(!p.hasProduct(Product.TRACTOR)){
				p.addCash(-2000);
			}
		}
	};
	public static OperatingExpense OE_CUSTOM_HIRE_2 = new OperatingExpense("Custom hire bill due.\nPay $2,000 if you do not own a harvester."){
		public void performAction(Player p){
			if(!p.hasProduct(Product.HARVESTOR)){
				p.addCash(-2000);
			}
		}
	};
	public static OperatingExpense OE_FERTILIZER_BILL = new OperatingExpense("Fertilizer bill due.\nPay $100 per acre."){
		public void performAction(Player p){
			int acres = 0;
			acres += p.getProductCount(Product.HAY);
			acres += p.getProductCount(Product.GRAIN);
			acres += p.getProductCount(Product.FRUIT);
			p.addCash(-100 * acres);
		}
	};
	public static OperatingExpense OE_EQUIPMENT_BREAKDOWN = new OperatingExpense("Equipment breakdown.\nPay $500."){
		public void performAction(Player p){
			p.addCash(-500);
		}
	};
	public static OperatingExpense OE_PARTS_BILL = new OperatingExpense("Parts bill due.\nPay $500."){
		public void performAction(Player p){
			p.addCash(-500);
		}
	};
	public static OperatingExpense OE_VET_BILL = new OperatingExpense("Veterinary bill due.\nPay $500 if you own cows."){
		public void performAction(Player p){
			if(p.hasProduct(Product.COWS)){
				p.addCash(-500);
			}
		}
	};
	public static OperatingExpense OE_ELECTRIC_BILL = new OperatingExpense("Electric bill for irrigation due.\nPay $500."){
		public void performAction(Player p){
			p.addCash(-500);
		}
	};
	public static OperatingExpense OE_INSURANCE_BILL = new OperatingExpense("Insurance bill due.\nPay $1,500."){
		public void performAction(Player p){
			p.addCash(-1500);
		}
	};
	public static OperatingExpense OE_GAS_BILL = new OperatingExpense("Gas bill due.\nPay $1,000."){
		public void performAction(Player p){
			p.addCash(-1000);
		}
	};
	public static OperatingExpense OE_DELAY_COSTS = new OperatingExpense("Equipment in shop. Delay costs.\nPay $1,000."){
		public void performAction(Player p){
			p.addCash(-1000);
		}
	};
	public static OperatingExpense OE_FEED_BILL = new OperatingExpense("Feed bill due.\nPay $100 per cow."){
		public void performAction(Player p){
			p.addCash(-100 * p.getProductCount(Product.COWS));
		}
	};
	public static OperatingExpense OE_FUMIGATION_BILL = new OperatingExpense("Wire worm ifects grain acreage.\nPay $100 per grain acre to fumigate."){
		public void performAction(Player p){
			p.addCash(-100 * p.getProductCount(Product.GRAIN));
		}
	};
	public static OperatingExpense OE_INTEREST_DUE = new OperatingExpense("Semi-annual interest due.\nPay 10% on Bank Notes on hand."){
		public void performAction(Player p){
			p.addCash((int) Math.round(-0.10 * p.getLoan()));
		}
	};
}